﻿#pragma once
#include <vector>
#include <string>
#include <set>

/// <summary>
/// 农历年
/// </summary>
class Mutex;
class LunarMonth;
class LunarYear
{
public:

	/// <summary>
	/// 年
	/// </summary>
	int Year;

	/// <summary>
	/// 天干下标
	/// </summary>
	int GanIndex;

	/// <summary>
	/// 地支下标
	/// </summary>
	int ZhiIndex;

	/// <summary>
	/// 月
	/// </summary>
	std::vector<LunarMonth>	 Months;

	/// <summary>
	/// 节气儒略日
	/// </summary>
	std::vector<double> JieQiJulianDays;


	/// <summary>
	/// 通过农历年初始化
	/// </summary>
	/// <param name="lunarYear">农历年</param>
	LunarYear(int lunarYear);

	const static LunarYear& FromYear(int lunarYear);
	/// <summary>
	/// 获取月份
	/// </summary>
	/// <param name="lunarMonth">月</param>
	/// <returns>农历月</returns>
	/// 
	const LunarMonth* GetMonth(int lunarMonth) const;


private:
	/// <summary>
	/// 元
	/// </summary>
	static const std::vector<std::string>  YUAN;

	/// <summary>
	/// 运
	/// </summary>
	static const std::vector<std::string> YUN;

	/// <summary>
	/// 闰冬月年份
	/// </summary>
	static std::set<int>  LEAP_11;

	/// <summary>
	/// 闰腊月年份
	/// </summary>
	static std::set<int>  LEAP_12;

	/// <summary>
	/// 月份
	/// </summary>
	static std::vector<int>  YMC;

	/// <summary>
	/// 缓存年
	/// </summary>
	static LunarYear* cacheYear;

	void Compute();

};

